package com.sunshine.wrongquestionset.view

import androidx.recyclerview.widget.RecyclerView
import com.sunshine.wrongquestionset.callback.OnListEmptyListener

/**
 * @author sunshine
 * @date 2021/4/13
 * 拥有空视图的
 */
abstract class HasEmptyRecyclerAdapter<VH : RecyclerView.ViewHolder?>(list: List<Any>?) : RecyclerView.Adapter<VH>(){

    private var list: List<Any>?

    /**
     * 判断当前列表是否为空
     */
    fun listIsEmpty(): Boolean {
        return list.isNullOrEmpty()
    }

    /**
     * 通知数据变化
     */
    fun notifyDataSetChanged(list: List<Any>?) {
        this.list = list
        //通知变化
        notifyDataSetChanged()
    }

    init {
        this.list = list
    }
}